/*
package com.gavindon.android.utils

import com.amap.api.location.AMapLocation
import com.amap.api.location.AMapLocationClient
import com.amap.api.location.AMapLocationClientOption
import com.amap.api.location.AMapLocationListener
import com.gavindon.android.base.MyApplication
import org.jetbrains.anko.toast


*/
/**
 * description:
 * Created by liNan on  2022-2-16 19:12
 *//*

object GdLocation {
    private lateinit var mLocationListener: AMapLocationListener
    private lateinit var mLocationClient: AMapLocationClient
    private lateinit var option: AMapLocationClientOption

    init {
        AMapLocationClient.updatePrivacyShow(MyApplication.appContext, true, true)
        AMapLocationClient.updatePrivacyAgree(MyApplication.appContext, true)
        mLocationClient = AMapLocationClient(MyApplication.appContext)
        option = AMapLocationClientOption()
//        option.setGpsFirst(true)
//        option.locationMode = AMapLocationClientOption.AMapLocationMode.Device_Sensors
        mLocationClient.setLocationOption(option)
        mLocationListener = AMapLocationListener {
            MyApplication.appContext.toast(it.address)
            if (it.errorCode == 0) {
            }
        }
        mLocationClient.setLocationListener(mLocationListener)

    }

    fun startLocation(): GdLocation {
        if (!mLocationClient.isStarted) {
            mLocationClient.startLocation()
        }
        return GdLocation
    }

    fun stopLocation() {
        mLocationClient.stopLocation()
    }

    fun gdLocationListener(listener: ((location: AMapLocation) -> Unit)? = null) {
        this.locationListener = listener
    }

    private var locationListener: ((location: AMapLocation) -> Unit)? = null

}*/
